<!doctype html>
<!--
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<script src="../../../webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="../../polymer.html">
<link rel="import" href="template-attr-template-import.html">
<script src="../../../tools/test/htmltest.js"></script>
<script src="../../../tools/test/chai/chai.js"></script>
<script>
  var testsRun = 0;
</script>


<polymer-element name="decoration-test2" extends="decoration-test">
  <template>
    <table>
      <thead>
        <th>one</th>
        <th>two</th>
        <th>three</th>
      </thead>
      <tbody id="tbody">
        <tr template repeat="{{ arr in arrs }}">
          <td template repeat="{{ n in arr }}">
            {{n}}
          </td>
        </tr>
      </tbody>
    </table>
  </template>
  <script>
    Polymer('decoration-test2', {
      arrs: [ [1,2,3], [4,5,6] ],
      test: function() {
        chai.assert.equal(this.$.tbody.children.length, 3, 'attribute template stamped');
        chai.assert.equal(this.$.tbody.children[1].children.length, 4, 'attribute sub-template stamped');
      }
    });
  </script>
</polymer-element>

<decoration-test></decoration-test>
<br>
<decoration-test2></decoration-test2>


<script>
  document.addEventListener('polymer-ready', function() {
    chai.assert.equal(testsRun, 2, 'decration tests ran');
    done();
  });
</script>
